<template>
	<view class="xiangqing-box">
		<view class="xiangqing-box-content">
			<view class="xiangqing-top">
				<view class="xiangqing-top-img">
					<image src="../../static/touxiang@2x.png" mode="widthFix"></image>
				</view>
				<view class="xiangqing-top-name">
					<view class="xiangqing-name biaoti1">
						{{name}}
					</view>
					<view class="xiangqing-xuehao zhengwen1">
						学号：{{sno}}
					</view>
					<view class="xiangqing-xuehao zhengwen1">
						专业班级：{{classname}}
					</view>
				</view>
			</view>

			
			<view class="leaveapply_box" style="padding: 10rpx 0 0 0;">
				<view class="leave_title">
					请假列表
				</view>
			</view>
			<view class="tongji-info">
				<view class="info-top">
					<view class="info-top-right">
						<view class="riqi  table_head">
							起止日期
						</view>
						<view class="liyou  table_head">
							请假理由
						</view>
						<view class="info-shichang  table_head">
							时长
						</view>
					</view>
				</view>
				<view class="info-center zhengwen2">
					<view class="info-center-right">
						<view class="info-center-right-n" v-for="(item,index) in leaveList" :key="index">
							<view class="qizhi">
								{{item.begintime?item.begintime.substring(0,16):''}} 至
									{{item.endtime?item.endtime.substring(0,16):''}}  
							</view>
							<view class="info-center-right-liyou">
								{{item.reason}}
							</view>
							<view class="info-center-right-shichang">
								{{item.hours}}小时
							</view>
						</view>
						
						<view class="info-bottom zhengwen2">
							合计: {{totalHours}}小时
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				sno: '',
				classname:'',
				idcard:'',
				name:'',
				tel:'',
				totalHours:0,
				leaveList:[]
			}
		},
		methods: {

		},
		onLoad(options) {
			this.sno = options.id
			console.log(this.sno)
			//获取某个学生请假详情
			uni.request({
				// url: "/api/appteacher/getLeaveOneStudentOfTeacherStatistics",
				url: this.baseUrl+ "/appteacher/getLeaveOneStudentOfTeacherStatistics?satoken="+uni.getStorageSync('satoken'),
				method: "POST",
				headers: {
					// "token": localStorage.getItem("token")
				},
				data: {
					sno: this.sno
				},
				success: (res) => {
					console.log('学生请假详情')
					console.log(res.data);
					this.classname=res.data.studentInfo.class_name,
					this.idcard=res.data.studentInfo.idcard,
					this.name=res.data.studentInfo.name,
					this.tel=res.data.studentInfo.tel,
					this.totalHours=res.data.totalHours
					this.leaveList=res.data.list
				}
			})

		}
	}
</script>

<style lang="scss">
	@import url(@/static/common.css);

.table_head{padding: 20rpx 0;border: none;color: #FBFAF9;}

	.xiangqing-box {
		width: 100%;
		box-sizing: border-box;
		overflow: hidden;
		padding-bottom: 40rpx;

		.xiangqing-box-content {
			width: 95%;
			margin: 0 auto;
			box-sizing: border-box;
			overflow: hidden;
			padding-top: 20rpx;

			.xiangqing-top {
				width: 100%;
				box-sizing: border-box;
				overflow: hidden;
				display: flex;
				flex-direction: row;

				.xiangqing-top-img {
					flex: 2;

					image {
						width: 100%;
					}
				}

				.xiangqing-top-name {
					flex: 5;
					display: flex;
					flex-direction: column;
					justify-content: center;
					// padding-left: 20rpx;
					margin-left: 20rpx;

					.xiangqing-xuehao {
						margin-top: 20rpx;
					}
				}
			}

			.xiangqing-number {
				width: 100%;
				box-sizing: border-box;
				overflow: hidden;
				display: flex;
				flex-direction: row;
				margin-top: 20rpx;

				view {
					flex: 1;
				}
			}

			.shenfenzheng {
				width: 100%;
				box-sizing: border-box;
				overflow: hidden;
				margin-top: 10rpx;
			}

			.xiangqing-biaoti {
				margin-top: 50rpx;
			}

			.tongji-info {
				width: 100%;
				box-sizing: border-box;
				overflow: hidden;
				margin-top: 20rpx;
				display: flex;
				flex-direction: column;

				.info-top {
					width: 100%;
					box-sizing: border-box;
					overflow: hidden;
					display: flex;
					flex-direction: row;
					background: #77312A;
					color: white;
					view {
						display: flex;
						align-items: center;
						justify-content: center;
						// border: 1px solid #999999;
						// padding: 10rpx;
					}

					.nianfen {
						flex: 2;
						border: 1px solid #999999;
						border-right: none;
					}

					.info-top-right {
						flex: 8;
						// border: 1px solid #999999;
						.riqi {
							// border: 1px solid #999999;
							flex: 3;
							border-right: none;
						}

						.liyou {
							// border: 1px solid #999999;
							flex: 4;
							border-right: none;
						}

						.info-shichang {
							// border: 1px solid #999999;
							flex: 1;
						}
					}
				}

				.info-center {
					width: 100%;
					box-sizing: border-box;
					overflow: hidden;
					display: flex;
					flex-direction: row;

					view {
						// padding: 10rpx;
						box-sizing: border-box;
					}

					.info-center-left {
						box-sizing: border-box;
						flex: 2;
						display: flex;
						justify-content: center;
						align-items: center;
						border: 1px solid #999999;
						border-right: none;
						border-top: none;
						// padding: 10rpx;
					}

					.info-center-right {
						flex: 8;
						display: flex;
						flex-direction: column;
						box-sizing: border-box;
						overflow: hidden;

						.info-center-right-n {
							width: 100%;
							display: flex;
							box-sizing: border-box;
							overflow: hidden;
							flex-direction: row;

							view {
								border: 1px solid #999999;
								box-sizing: border-box;
								padding: 10rpx 10rpx;
								display: flex;
								align-items: center;

							}

							.qizhi {
								flex: 3;
								// border-right: none;
								border-top: none;
								justify-content: center;
							}

							.info-center-right-liyou {
								flex: 4;
								border-left: none;
								border-top: none;
								border-right: none;
								text-align: center;
							}

							.info-center-right-shichang {
								flex: 1;
								border-top: none;
								text-align: center;
							}
						}
					}
				}

				.info-bottom {
					width: 100%;
					box-sizing: border-box;
					overflow: hidden;
					display: flex;
					flex-direction: row;
					border: 1rpx solid #999999;
					border-top: none;
					align-items: center;
					justify-content: center;
					padding: 20rpx;
				}
			}
		}
	}
</style>
